<?php

use Core\API_Controller;
use Libraries\SMS;

class SmsController extends API_Controller
{
	public function send()
	{
		$this->load->library('form_validation');
		$this->form_validation->set_rules('type', '类型', 'required|in_list[bindPhone]')
		->set_rules('phone', '手机号', 'required|is_mobile');
		if ($this->form_validation->run()) {
			SMS::sendIdentifyCode($this->input->post('phone'), $this->input->post('type'));

			return $this->success();
		} else {
			return $this->validateError($this->form_validation->error_string());
		}
	}
}